home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Developer Essentials / DTS Sample Code / DTS Japan-Sample Code / QuickTime•MacApp2.0•6.0.7 / DemoText.r < prev    next >
Encoding:
Text File  |  1992-02-05  |  10.7 KB  |  416 lines  |  [TEXT/MPS ]

  1. /* Copyright © 1986-1990 by Apple Computer, Inc.  All rights reserved. */
  2.  
  3. /* Copyright © 1991 by Taro Tanaka, Japan DTS, Apple Computer Japan, Inc. All rights reserved. */
  4.  
  5.  
  6. /* • Auto-Include the requirements for this source */
  7. #ifndef __TYPES.R__
  8. #include "Types.r"
  9. #endif
  10.  
  11. #ifndef __MacAppTypes__
  12. #include "MacAppTypes.r"
  13. #endif
  14.  
  15. #if qTemplateViews
  16. #ifndef __ViewTypes__
  17. #include "ViewTypes.r"
  18. #endif
  19. #endif
  20.  
  21. #if qDebug
  22. include "Debug.rsrc";
  23. #endif
  24. include "MacApp.rsrc";
  25. include "Printing.rsrc";
  26.  
  27. include $$Shell("ObjApp")"DemoText" 'CODE';
  28.  
  29. /* Resource ids */
  30.  
  31. #define kFileTooBig        1000                /* The 'File is too large' alert */
  32. #define kWindowRsrcID    1004
  33. #define kViewRsrcID        1005
  34.  
  35. #define kPromptsRsrcID    1005                /* STR# resource containing prompts */
  36.  
  37. #define mStyle               8                /* Hierarchical sub-menus */
  38. #define mSize               9
  39. #define mFont              10
  40. #define mColor              11
  41. #define hmStyle            "\0x08"                /* Byte values of hierarchical menu ids */
  42. #define hmSize            "\0x09"
  43. #define hmFont            "\0x0A"
  44. #define hmColor            "\0x0B"
  45.  
  46. #define kHierDisplayedMBar        131            /* MenuBar on hierarchical menu system */
  47.  
  48. /* Command numbers */
  49.  
  50. #define cWidthFrame         601                /* View-width-determination commands */
  51. #define cWidthView         602
  52. #define cWidthOnePage     603
  53.  
  54. #define cHeightFrame     604                /* View-height-determination commands */
  55. #define cHeightPages     605
  56. #define cHeightText         606
  57. #define cHeightConst     607
  58.  
  59. #define cJustLeft         608                /* Justification commands */
  60. #define cJustCenter         609
  61. #define cJustRight         610
  62.  
  63. #define cPlainText        1001                /* Typestyle attributes */
  64. #define cBold            1002
  65. #define cItalic         1003
  66. #define cUnderline        1004
  67. #define cOutline        1005
  68. #define cShadow         1006
  69. #define cCondense        1007
  70. #define cExtend         1008
  71.  
  72. #define cSizeChange     1100                /* Font-size commands */
  73. #define cSizeBase        1100
  74. #define cSizeMin        1109
  75. #define cSizeMax        1124
  76. #define cSizeGrow        1198
  77. #define cSizeShrink     1199
  78.  
  79. #define cJustChange     1200                /* Command numbers to cover other stylistic changes */
  80. #define cFontChange     1300
  81.  
  82. #define cStyle            1401                /* Command numbers for the hierarchial menu */
  83. #define cSize            1402
  84. #define cFont            1403
  85. #define cColor            1404
  86.  
  87. #define cColorChange    1500                /* Command numbers for changing colors */
  88. #define cColorText        1501
  89. #define cColorBackground 1502
  90.  
  91. #define cImportMovie    1600
  92.  
  93. #define kSignature        'yuki'                /* Application signature */
  94.  
  95. include "Views.rsrc"  'view' (kWindowRsrcID);
  96. include "Views.rsrc"  'view' (kViewRsrcID);
  97.  
  98. resource 'STR#' (kPromptsRsrcID, purgeable) {
  99.     {
  100. /* [ 1] */    "Select a new text color…",
  101. /* [ 2] */    "Select background color…"
  102.     }
  103. };
  104.  
  105. resource 'SIZE' (-1) {
  106.     saveScreen,
  107.     acceptSuspendResumeEvents,
  108.     enableOptionSwitch,
  109.     canBackground,
  110.     MultiFinderAware,
  111.     backgroundAndForeground,
  112.     dontGetFrontClicks,
  113.     ignoreChildDiedEvents,
  114.     is32BitCompatible,
  115.     reserved,
  116.     reserved,
  117.     reserved,
  118.     reserved,
  119.     reserved,
  120.     reserved,
  121.     reserved,
  122. #if qdebug
  123.     450 * 1024,
  124.     368 * 1024
  125. #else
  126.     300 * 1024,
  127.     200 * 1024
  128. #endif
  129. };
  130.  
  131. /*    Printing to the LaserWriter is the time when the most temporary memory
  132.     is in use.  We need the segments in use at that time */
  133.  
  134. resource 'seg!' (256, purgeable) {
  135.     {
  136.         "GWriteFile";
  137.         "GClipboard";
  138.         "GNonRes";
  139.         "GFile";
  140.         "GSelCommand";
  141.         "GTerminate";
  142.         "GClose";
  143.         "GDoCommand";
  144.     }
  145. };
  146.  
  147. resource 'DITL' (phAboutApp, purgeable) {
  148.      {
  149. /* [ 1] */    {160, 182, 180, 262},
  150.             Button {
  151.                 enabled,
  152.                 "OK"
  153.             };
  154. /* [ 2] */    {10, 75, 150, 320},
  155.             StaticText {
  156.                 disabled,
  157.                     "This sample program demonstrates how to use QuickTime® "
  158.                     "building block of MacApp.\n\nThis program was written "
  159.                     "with MacApp® © 1985-1990 Apple Computer, Inc."
  160.             };
  161. /* [ 3] */    {10, 20, 42, 52},
  162.             Icon {
  163.                 disabled,
  164.                 1
  165.             }
  166.     }
  167. };
  168.  
  169. include "Defaults.rsrc"  'ALRT' (phAboutApp);    // Grab the default about box
  170.  
  171. /* Used when the user attempts to read a file larger than we can handle */
  172.  
  173. resource 'DITL' (kFileTooBig, purgeable) {
  174.     {
  175. /* [ 1] */    {82, 198, 100, 272},
  176.                 Button {
  177.                     enabled,
  178.                     "OK"
  179.                 };
  180. /* [ 2] */    {10, 70, 77, 272},
  181.                 StaticText {
  182.                     disabled,
  183.                     "DemoText can’t read the entire file because it is too long."
  184.                 };
  185. /* [ 3] */    {10, 20, 42, 52},
  186.                 Icon {
  187.                     disabled,
  188.                     0
  189.                 }
  190.     }
  191. };
  192.  
  193. resource 'ALRT' (kFileTooBig, purgeable) {
  194.     {100, 110, 210, 402},
  195.     kFileTooBig,
  196.     {
  197. /* [ 1] */    OK, visible, silent;
  198. /* [ 2] */    OK, visible, silent;
  199. /* [ 3] */    OK, visible, silent;
  200. /* [ 4] */    OK, visible, silent
  201.     }
  202. };
  203.  
  204. include "Defaults.rsrc" 'cmnu' (mApple);        // Grab the default Apple/File menus
  205.  
  206. resource 'cmnu' (mFile,
  207. #if qNames
  208. "mFile",
  209. #endif
  210. nonpurgeable) {
  211.     mFile,
  212.     textMenuProc,
  213.     0x7FFFFFFD,
  214.     enabled,
  215.     "File",
  216.     {
  217.     "New",                noIcon, "N",    noMark, plain, cNew;
  218.     "Open…",            noIcon, "O",    noMark, plain, cOpen;
  219.     "-",                noIcon, noKey,    noMark, plain, nocommand;
  220.     "Close",            noIcon, "W",    noMark, plain, cClose;
  221.     "Save",                noIcon, "S",    noMark, plain, cSave;
  222.     "Save As…",            noIcon, noKey,    noMark, plain, cSaveAs;
  223.     "Save a Copy In…",    noIcon, noKey,    noMark, plain, cSaveCopy;
  224.     "Revert",            noIcon, noKey,    noMark, plain, cRevert;
  225.     "-",                noIcon, noKey,    noMark, plain, nocommand;
  226.     "Page Setup…",        noIcon, noKey,    noMark, plain, cPageSetup;
  227.     "Print One",        noIcon, noKey,    noMark, plain, cPrintOne;
  228.     "Print…",            noIcon, "P",    noMark, plain, cPrint;
  229.     "-",                noIcon, noKey,    noMark, plain, nocommand;
  230.     "Import Movie…",        noIcon, noKey,    noMark,    plain, cImportMovie;
  231.     "-",                noIcon, noKey,    noMark, plain, nocommand;
  232.     "Quit",                noIcon, "Q",    noMark, plain, cQuit
  233.     }
  234. };
  235.  
  236. resource 'cmnu' (mEdit) {
  237.     mEdit,
  238.     textMenuProc,
  239.     AllEnabled,
  240.     enabled,
  241.     "Edit",
  242.      {
  243. /* [ 1] */    "Undo",                noIcon,    "Z",    noMark,    plain,    cUndo;
  244. /* [ 2] */    "-",                noIcon,    noKey,    noMark,    plain,    nocommand;
  245. /* [ 3] */    "Cut",                noIcon,    "X",    noMark,    plain,    cCut;
  246. /* [ 4] */    "Copy",                noIcon,    "C",    noMark,    plain,    cCopy;
  247. /* [ 5] */    "Paste",            noIcon,    "V",    noMark,    plain,    cPaste;
  248. /* [ 6] */    "Clear",            noIcon,    noKey,    noMark,    plain,    cClear;
  249. /* [ 7] */    "-",                noIcon,    noKey,    noMark,    plain,    nocommand;
  250. /* [ 8] */    "Select All",        noIcon,    "A",    noMark,    plain,    cSelectAll;
  251. /* [ 9] */    "-",                noIcon,    noKey,    noMark,    plain,    nocommand;
  252. /* [10] */    "Show Clipboard",    noIcon,    noKey,    noMark,    plain,    cShowClipboard;
  253. /* [11] */    "-",                noIcon,    noKey,    noMark,    plain,    nocommand;
  254. /* [12] */    "Show Page Breaks",    noIcon, noKey,    noMark,    plain,    cShowBreaks
  255.     }
  256. };
  257.  
  258. resource 'cmnu' (5) {
  259.     5,
  260.     textMenuProc,
  261.     AllEnabled,
  262.     enabled,
  263.     "Text",
  264.      {
  265. /* [ 1] */    "View as wide as frame",
  266.                                 noIcon,    noKey,    noMark,    plain,    cWidthFrame;
  267. /* [ 2] */    "View width frozen",
  268.                                 noIcon,    noKey,    noMark,    plain,    cWidthView;
  269. /* [ 3] */    "View as wide as one page",
  270.                                 noIcon,    noKey,    noMark,    plain,    cWidthOnePage;
  271. /* [ 4] */    "-",                noIcon,    noKey,    noMark,    plain,    nocommand;
  272. /* [ 5] */    "View as high as the frame",
  273.                                 noIcon,    noKey,    noMark,    plain,    cHeightFrame;
  274. /* [ 6] */    "View height an exact number of pages",
  275.                                 noIcon,    noKey,    noMark,    plain,    cHeightPages;
  276. /* [ 7] */    "View as high as its content",
  277.                                 noIcon,    noKey,    noMark,    plain,    cHeightText;
  278. /* [ 8] */    "View height frozen",
  279.                                 noIcon,    noKey,    noMark,    plain,    cHeightConst;
  280. /* [ 9] */    "-",                noIcon,    noKey,    noMark,    plain,    nocommand;
  281. /* [10] */    "Left justified",    noIcon,    noKey,    noMark,    plain,    cJustLeft;
  282. /* [11] */    "Center justified",    noIcon,    noKey,    noMark,    plain,    cJustCenter;
  283. /* [12] */    "Right justified",    noIcon,    noKey,    noMark,    plain,    cJustRight
  284.     }
  285. };
  286.  
  287. /* Hierarchical  Format menu with Style, Size and Font submenus */
  288. resource 'cmnu' (7) {
  289.     7,
  290.     textMenuProc,
  291.     allEnabled,
  292.     enabled,
  293.     "Format",
  294.      {
  295. /* [ 1] */    "Style",            noIcon, kHierarchicalMenu, hmStyle, plain, cStyle;
  296. /* [ 2] */    "Size",                noIcon, kHierarchicalMenu, hmSize, plain, cSize;
  297. /* [ 3] */    "Font",                noIcon, kHierarchicalMenu, hmFont, plain, cFont;
  298. /* [ 4] */    "Color",            noIcon, kHierarchicalMenu, hmColor, plain, cColor
  299.     }
  300. };
  301.  
  302. /* Hierarchical Style Sub-menu */
  303. resource 'cmnu' (mStyle) {
  304.     mStyle,
  305.     textMenuProc,
  306.     allEnabled,
  307.     enabled,
  308.     "Style",
  309.      {
  310. /* [ 1] */    "Plain Text",        noIcon,    noKey,    noMark,    plain,        cPlainText;
  311. /* [ 2] */    "Bold",                noIcon,    noKey,    noMark,    bold,        cBold;
  312. /* [ 3] */    "Italic",            noIcon,    noKey,    noMark,    italic,        cItalic;
  313. /* [ 4] */    "Underline",        noIcon,    noKey,    noMark,    underline,    cUnderline;
  314. /* [ 5] */    "Outline",            noIcon,    noKey,    noMark,    outline,    cOutline;
  315. /* [ 6] */    "Shadow",            noIcon,    noKey,    noMark,    shadow,        cShadow;
  316. /* [ 7] */    "Condensed",        noIcon,    noKey,    noMark, condense,    cCondense;
  317. /* [ 8] */    "Extended",            noIcon,    noKey,    noMark, extend,        cExtend
  318.     }
  319. };
  320.  
  321. /* Hierarchical Size Sub-menu */
  322. resource 'cmnu' (mSize) {
  323.     mSize,
  324.     textMenuProc,
  325.     AllEnabled,
  326.     enabled,
  327.     "Size",
  328.      {
  329. /* [ 1] */    " 9 Point",            noIcon,    noKey,    noMark,    plain,    cSizeBase+9;
  330. /* [ 2] */    "10 Point",            noIcon,    noKey,    noMark,    plain,    cSizeBase+10;
  331. /* [ 3] */    "12 Point",            noIcon,    noKey,    noMark,    plain,    cSizeBase+12;
  332. /* [ 4] */    "14 Point",            noIcon,    noKey,    noMark,    plain,    cSizeBase+14;
  333. /* [ 5] */    "18 Point",            noIcon,    noKey,    noMark,    plain,    cSizeBase+18;
  334. /* [ 6] */    "24 Point",            noIcon,    noKey,    noMark,    plain,    cSizeBase+24;
  335. /* [ 7] */    "-",                noIcon,    noKey,    noMark,    plain,    nocommand;
  336. /* [ 8] */    "Grow selection",    noIcon,    "]",    noMark,    plain,    cSizeGrow;
  337. /* [ 9] */    "Shrink selection",    noIcon,    "[",    noMark,    plain,    cSizeShrink
  338.  
  339.      }
  340. };
  341.  
  342. /* Font menu for hierarchical or non-hierarchical system */
  343. resource 'MENU' (mFont) {
  344.     mFont,
  345.     textMenuProc,
  346.     allEnabled,
  347.     enabled,
  348.     "Font",
  349.     { }
  350. };
  351.  
  352. resource 'cmnu' (mColor) {
  353.     mColor,
  354.     textMenuProc,
  355.     allEnabled,
  356.     enabled,
  357.     "Color",
  358.     {
  359. /* [ 1] */    "Set text color…",    noIcon,    "T",    noMark,    plain,    cColorText;
  360. /* [ 2] */    "Set background color…",
  361.                                 noIcon,    "K",    noMark,    plain,    cColorBackground
  362.     }
  363. };
  364.  
  365. resource 'cmnu' (mBuzzwords) {
  366.     mBuzzwords,
  367.     textMenuProc,
  368.     allEnabled,
  369.     enabled,
  370.     "Buzzwords",
  371.     {
  372.         "Typing",                noIcon,    noKey,    noMark,    plain,    cTyping;
  373.         "Style Change",            noIcon,    noKey,    noMark,    plain,    cStyleChange;
  374.         "Size Change",            noIcon,    noKey,    noMark,    plain,    cSizeChange;
  375.         "Justification Change",    noIcon,    noKey,    noMark,    plain,    cJustChange;
  376.         "Font Change",            noIcon,    noKey,    noMark,    plain,    cFontChange;
  377.         "Color Change",            noIcon,    noKey,    noMark,    plain,    cColorChange;
  378.         "Page Setup Change",    noIcon,    noKey,    noMark,    plain,    cChangePrinterStyle
  379.     }
  380. };
  381.  
  382. /* Displayed menus on a non-hierarchical system */
  383. resource 'MBAR' (kMBarDisplayed) {
  384.     {mApple; mFile; mEdit; 5; 8; 9; 10; 11}
  385. };
  386.  
  387. /* Displayed menus on a hierarchical system */
  388. resource 'MBAR' (kHierDisplayedMBar) {
  389.     {mApple; mFile; mEdit; 5; 7}
  390. };
  391.  
  392. /* Hierarchial Sub-Menus */
  393. resource 'MBAR' (kMBarHierarchical) {
  394.     {8; 9; 10; 11}
  395. };
  396.  
  397. type kSignature as 'STR ';
  398. resource kSignature (0,
  399. #if qNames
  400. "Signature",
  401. #endif
  402.     purgeable) {
  403.     "DemoText 2.0 ©Apple Computer, Inc. 1988-1990"
  404. };
  405.  
  406. // Get the application icon and file reference
  407. include    "Resources.rsrc"  'ICN#';
  408. include "Resources.rsrc"  'icl4';
  409. include "Resources.rsrc"  'icl8';
  410. include "Resources.rsrc"  'FREF';
  411. include "Resources.rsrc"  'BNDL';
  412.  
  413. // Get the default Version resources
  414. include "Defaults.rsrc"  'vers' (1);        // Application or file specific
  415. include "Defaults.rsrc"  'vers' (2);        // Overall package
  416.